<?php

class Pharing_Picasa extends Pharing_Service
{
	public function fetch($user)
	{
		return $this->_parseRss($this->_callApi($user));
	}
	
	protected function _callApi($user)
	{
		$rssUrl = 'http://picasaweb.google.com/data/feed/base/user/'
		        . urlencode($user) . '?alt=rss&kind=photo';
		return $this->_urlGetContents($rssUrl);
	}
	
	protected function _parseRss($rss)
	{
		$pattern = "/<enclosure[^>]+url='([^']+)'/";
		if (preg_match_all($pattern, $rss, $matches)) {
			return $matches[1];	
		}
		return array();
	}
}